package com.mjkj.demo.utils;
/*
 ** @Author:      Geraint
 ** @CreateDate:  2023-12-04  16:11
 ** @ProjectName: TeaExpoPark
 ** @Package:     com.mjkj.demo.utils
 ** @Edit :       geraint
 ** @EditDate:    2023-12-04  16:11
 */

import java.util.regex.Pattern;

public class IPAddressUtils {
    private static final String IP_ADDRESS_PATTERN =
            "^([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\." +
                    "([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\." +
                    "([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\." +
                    "([01]?\\d\\d?|2[0-4]\\d|25[0-5])$";

    public static boolean isValidIPAddress(String ipAddress) {
        return Pattern.matches(IP_ADDRESS_PATTERN, ipAddress);
    }
}
